/**
 * com.monte.test.model.MessDao.java
 * create by FengMy from 2013
 */
package com.monte.test.model;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * @描述:
 * @author FengMy
 */
@Component(value="messDao")
@Transactional
public class MessDao {
	@PersistenceContext
	private EntityManager entityManager;

	public void insert(Mess mess){
		entityManager.persist(mess);
	}
	
	public Mess getEntity(String id){
		return entityManager.find(Mess.class, id);
	}
	
	public void updateEntity(Mess mess){
		entityManager.merge(mess);
	}
	
	public List<Mess> selectList(){
		return entityManager
			.createQuery("SELECT m FROM com.monte.test.model.Mess m", Mess.class)
			.setFirstResult(0)
			.setMaxResults(100)
			.getResultList();
	}

}
